package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;

import java.util.List;

public interface ShoppingCartMapper {
    //根据条件查询购物车
    ShoppingCart getBy(ShoppingCart shoppingCart);

    //更新数量
    void update(ShoppingCart cartDB);

    //新增购物车
    void insert(ShoppingCart shoppingCart);

    //根据用户id查询购物车
    List<ShoppingCart> getByUserId(Long userId);

    //根据用户id删除购物车数据
    void deleteByUserId(Long currentId);

    /**
     * 根据id删除购物车数据
     * @param id
     */
    @Delete("delete from shopping_cart where id = #{id}")
    void deleteById(Long id);
}
